import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/home/board/get_message_entity.dart';

GetMessageEntity $GetMessageEntityFromJson(Map<String, dynamic> json) {
  final GetMessageEntity getMessageEntity = GetMessageEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    getMessageEntity.id = id;
  }
  final int? userId = jsonConvert.convert<int>(json['userId']);
  if (userId != null) {
    getMessageEntity.userId = userId;
  }
  final String? userType = jsonConvert.convert<String>(json['userType']);
  if (userType != null) {
    getMessageEntity.userType = userType;
  }
  final int? templateId = jsonConvert.convert<int>(json['templateId']);
  if (templateId != null) {
    getMessageEntity.templateId = templateId;
  }
  final String? templateCode = jsonConvert.convert<String>(json['templateCode']);
  if (templateCode != null) {
    getMessageEntity.templateCode = templateCode;
  }
  final String? templateNickname = jsonConvert.convert<String>(json['templateNickname']);
  if (templateNickname != null) {
    getMessageEntity.templateNickname = templateNickname;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    getMessageEntity.title = title;
  }
  final String? templateContent = jsonConvert.convert<String>(json['templateContent']);
  if (templateContent != null) {
    getMessageEntity.templateContent = templateContent;
  }
  final int? templateType = jsonConvert.convert<int>(json['templateType']);
  if (templateType != null) {
    getMessageEntity.templateType = templateType;
  }
  final dynamic templateParams = json['templateParams'];
  if (templateParams != null) {
    getMessageEntity.templateParams = templateParams;
  }
  final bool? readStatus = jsonConvert.convert<bool>(json['readStatus']);
  if (readStatus != null) {
    getMessageEntity.readStatus = readStatus;
  }
  final String? readTime = jsonConvert.convert<String>(json['readTime']);
  if (readTime != null) {
    getMessageEntity.readTime = readTime;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    getMessageEntity.createTime = createTime;
  }
  return getMessageEntity;
}

Map<String, dynamic> $GetMessageEntityToJson(GetMessageEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['userId'] = entity.userId;
  data['userType'] = entity.userType;
  data['templateId'] = entity.templateId;
  data['templateCode'] = entity.templateCode;
  data['templateNickname'] = entity.templateNickname;
  data['title'] = entity.title;
  data['templateContent'] = entity.templateContent;
  data['templateType'] = entity.templateType;
  data['templateParams'] = entity.templateParams;
  data['readStatus'] = entity.readStatus;
  data['readTime'] = entity.readTime;
  data['createTime'] = entity.createTime;
  return data;
}

extension GetMessageEntityExtension on GetMessageEntity {
  GetMessageEntity copyWith({
    int? id,
    int? userId,
    String? userType,
    int? templateId,
    String? templateCode,
    String? templateNickname,
    String? title,
    String? templateContent,
    int? templateType,
    dynamic templateParams,
    bool? readStatus,
    String? readTime,
    String? createTime,
  }) {
    return GetMessageEntity()
      ..id = id ?? this.id
      ..userId = userId ?? this.userId
      ..userType = userType ?? this.userType
      ..templateId = templateId ?? this.templateId
      ..templateCode = templateCode ?? this.templateCode
      ..templateNickname = templateNickname ?? this.templateNickname
      ..title = title ?? this.title
      ..templateContent = templateContent ?? this.templateContent
      ..templateType = templateType ?? this.templateType
      ..templateParams = templateParams ?? this.templateParams
      ..readStatus = readStatus ?? this.readStatus
      ..readTime = readTime ?? this.readTime
      ..createTime = createTime ?? this.createTime;
  }
}